<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<meta name="apple-mobile-web-app-capable" content="yes">
		<meta name="apple-mobile-web-app-status-bar-style" content="black">
		<title>view/workArea/parts/searchPartsFse</title>
		<!-- css代码 start -->
		<link href="../../../css/mui.min.css" rel="stylesheet" />
		<link href="../../../css/global.css" rel="stylesheet" />
		<link href="../../../css/style.css" rel="stylesheet" />
		<link href="../../../css/checkbox.css" rel="stylesheet" />
		<link href="../../../css/task.css" rel="stylesheet" />
		<style>
			.d_int_tp{
				border: 0 !important;
				margin-top: 6px !important;
			}
			.mui-checkbox input[type=checkbox], .mui-radio input[type=radio]{
				top: 8px;
				right: -10px;
			}
			
			.item_box .item .text{
				padding: 0 17px;
				height: auto;
				line-height: 30px;
				font-size: 14px;
				word-wrap:break-word;
			}
			.select-tzstate{
				width: 100%;
				border: 0;
				color: #a9a9a9;
				font-size: 16px;
				text-align: left;
				padding: 15px;
			}
			.mui-bar-nav{
				box-shadow: 0 1px 6px #ea1e1a;
			}
			.lpl{
				width: 105px !important;
			}
		</style>
		<!-- css代码 end -->
	</head>
	<body>
		
		<header class="mui-bar mui-bar-nav">
			<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
			<h1 id="title" class="mui-title">查询其他FSE备件</h1>
		</header>
		<div class="mui-content">
			<div class="details_con select_con" id="search">
				<div class="clum">
					<input type="text" class="d_int_tp" id="enginnerName" placeholder="请输入FSE" />
				</div>
				<div class="clum">
					<input type="text" class="d_int_tp" id="partCode" placeholder="请输入备件号" />
				</div>
				<div class="btm autoHeight">
					<p class="selectBtn" id="searchBtn" onclick="selectList()">查 询</p>
				</div>
			</div>
			
			<div class="details_con" style="margin: 30px 0 0 0;">
				<div class="item_box" id="itemBox"></div>
				<div style="height: 50px;"></div>
			</div>
		</div>
		
		
		
		<!-- js代码 start -->

		<!-- 基础js start -->
		<script src="../../../js/mui.min.js"></script>
		<script src="../../../js/utils/h.js"></script>
		<script src="../../../js/constant.js"></script>
		<script src="../../../js/common.js"></script>
		<script src="../../../js/utils/base64.js"></script>
		<script src="../../../js/utils/md5.js"></script>
		<script src="../../../js/utils/sortMap.js"></script>
		<script src="../../../js/utils/http.js"></script>
		<script src="../../../js/app.js"></script>
		<!-- 基础js end -->

		<script type="text/javascript" charset="utf-8">
			(function($, doc) {
				$.init();
		
				$.plusReady(function() {
					// selectList();
				});
			}(mui, document));
			
			// 查询其他FSE名下已收货未使用的备件
			function selectList(){		
				var enginnerId = app.getUser().enginnerId;
				var enginnerName = h("#enginnerName").val();
				var partCode = h("#partCode").val();
				
				if(!enginnerName && !partCode){
					app.toast("请输入FSE或备件号查询")
					return
				}
				app.showWaiting('加载中...')
				ajaxPost(BASE_URL + "cc/spareParts/getPartInfoByCode",{
					"enginnerId": enginnerId,
					"status": "5",
					"partCode": partCode,
					"enginnerName": enginnerName
				},function(data) {
					app.closeWaiting()
					if (data.code === 200) {
						var str = '';
						// var dataObj = JSON.parse(data.data);
						var dataObj = data.data;
						var list = dataObj.record;
						// alert(JSON.stringify(list))
						// 无数据
						if (list.length == 0) {
							h("#itemBox").html('<div class="nodata">—— 暂无数据 ——</div>');
							return false;
						}
						// 显示列表
						for(var i = 0; i<list.length; i++){
							var info = list[i];
							str += '<div class="item" onclick="jumpToNext(\''+ info.Part_id +'\', \''+ info.enginner_id +'\')">';
							str += '<div class="bar">';
							str += '<span class="number">'+ info.Part_no +'<img src="../../../images/icon_204.png" /></span>';
							str += '</div>';
							str += '<div class="text">';
							str += '<span class="l">备件名称：</span>'+ info.Part_name;
							str += '</div>';
							str += '<div class="type">';
							str += '<p><img src="../../../images/icon_219.png"/><div class="lpl">FSE：</div><span>'+ info.enginner_name +'</span></p>';
							str += '<p><img src="../../../images/icon_217.png"/><div class="lpl">备件数量：</div><span>'+ info.Part_qty +'</span></p>';
							str += '<p><img src="../../../images/icon_205.png"/><div class="lpl">备件状态：</div><span>'+ partStatusName(info.Status) +'</span></p>';
							str += '<p><img src="../../../images/icon_218.png"/><div class="lpl">借货单号：</div><span>'+ info.Part_DebitNo +'</span></p>';
							str += '<p><img src="../../../images/icon_220.png"/><div class="lpl">手机号：</div><span><a href="tel:'+info.enginner_mobile+'">'+info.enginner_mobile+'</a></span></p>';
							str += '<p><img src="../../../images/icon_201.png"/><div class="lpl">借货用户名称：</div><span>'+ emptyStr(info.CustName) +'</span></p>';
							str += '<p><img src="../../../images/icon_2_c.png"/><div class="lpl">已收货天数：</div><span>'+ emptyStr(info.days) +'</span></p>';
							str += '</div>';
							str += '</div>';
						}
						h('#itemBox').html(str);
					} else {
						h("#itemBox").html('<div class="nodata">—— 暂无数据 ——</div>');
						app.toast(data.msg)
					}
				}, function(errorMsg) {
					app.closeWaiting()
					h("#itemBox").html('<div class="nodata">—— 暂无数据 ——</div>');
					app.toast("数据获取失败，请检查网络连接");
				});
			}
			
			// 跳转下一页
			function jumpToNext(Part_id, enginnerId) {
				app.jumpTo("/view/workArea/parts/partsDetail.html","view/workArea/parts/partsDetail", {
					"Part_id" : Part_id,
					"enginnerId" : enginnerId
				})
			}
		</script>
		<!-- js代码 end -->
	</body>
</html>